<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" import="java.util.*,com.hanma.bean.*" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>文档列表 - 光年(Light Year Admin)后台管理系统模板</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
    <meta name="author" content="yinqi">
    <link href="/message/manage/css/bootstrap.min.css" rel="stylesheet">
    <link href="/message/manage/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/message/manage/css/style.min.css" rel="stylesheet">
</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <%@include file="/manage/left.jsp" %>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header">
            <nav class="navbar navbar-default">
                <div class="topbar">
                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> 管理员页面 </span>
                    </div>
                    <ul class="topbar-right">
                        <li class="dropdown dropdown-profile">
                            <a href="javascript:void(0)" data-toggle="dropdown">
                                <span>笔下光年 <span class="caret"></span></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right">
                                <li> <a href="/message/manageIndex.do"><i class="mdi mdi-account"></i> 个人信息</a> </li>
                                <li> <a href="/message/manageLogin.do"><i class="mdi mdi-logout-variant"></i> 退出登录</a> </li>
                            </ul>
                        </li>
                        <%@include file="/manage/header.jsp" %>
                    </ul>
                </div>
            </nav>
        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">

                                <div class="edit-avatar">
                                    <img src="/message/manage/images/users/avatar.jpg" alt="..." class="img-avatar">
                                    <div class="avatar-divider"></div>
                                    <div class="edit-avatar-content">
                                        <button class="btn btn-default">修改头像</button>
                                        <p class="m-0">选择一张你喜欢的图片，裁剪后会自动生成264x264大小，上传图片大小不能超过2M。</p>
                                    </div>
                                </div>
                                <hr>
                                <%
                                    Manager manager = (Manager) request.getAttribute("manager");
                                    if (manager.getPid() != 0){
                                %>
                                    <div class="form-group">
                                        <label for="username">普通管理员名称</label>
                                        <input type="text" class="form-control" name="username" value="${manager.username}" disabled="disabled" />
                                    </div>
                                    <span class="btn btn-primary">无新增管理员权限</span>
                                    <a class="btn btn-primary" href="/message/manageLoginAction.do">返回</a>
                                <%
                                    }else{
                                %>
                                    <form method="post" action="/message/manageAdd.do" class="site-form">
                                        <div class="form-group">
                                            <label for="username">超级管理员名称</label>
                                            <input type="text" class="form-control" name="username" id="username" value="${manager.username}" disabled="disabled" />
                                        </div>
                                        <label for="username">普通管理员</label>
                                        <div class="table-responsive">
                                            <table class="table table-bordered">
                                                <thead>
                                                <tr>
                                                    <th>id</th>
                                                    <th>姓名</th>
                                                    <th>密码</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <c:forEach items="${managerList}" var="manager">
                                                    <tr>
                                                        <td>${manager.id}</td>
                                                        <td>${manager.username}</td>
                                                        <td>${manager.password}</td>
                                                    </tr>
                                                </c:forEach>
                                                </tbody>
                                            </table>
                                        </div>
                                        <button type="submit" class="btn btn-primary">新增</button>
                                        <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                                    </form>
                                <%
                                    }
                                %>
                            </div>
                        </div>
                    </div>

                </div>

            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>

<script type="text/javascript" src="/message/manage/js/jquery.min.js"></script>
<script type="text/javascript" src="/message/manage/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/message/manage/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/message/manage/js/main.min.js"></script>
<script type="text/javascript">
    $(function(){
        $('.search-bar .dropdown-menu a').click(function() {
            var field = $(this).data('field') || '';
            $('#search-field').val(field);
            $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
        });
    });
</script>
</body>
</html>